﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace WowGuildSite.Armory
{
    public class ArmoryItemDamage
    {
        private int     min;
        private int     max;
        private decimal dps;
        private decimal speed;

        public int      Min
        {
            get { return min;}
        }

        public int      Max
        {
            get { return max; }
        }

        public decimal  Dps
        {
            get { return dps; }
        }

        public decimal  Speed
        {
            get { return speed; }
        }

        internal static ArmoryItemDamage FromElement( XmlElement element )
        {
            if ( element == null )
            {
                return new ArmoryItemDamage();
            }

            ArmoryItemDamage damage = new ArmoryItemDamage();

            XmlElement damageElement = ArmoryXmlUtility.GetChildElement(element, "damage");
            
            damage.min      = ArmoryXmlUtility.GetChildElementInt(damageElement, "min");
            damage.max      = ArmoryXmlUtility.GetChildElementInt(damageElement, "max");

            damage.speed    = ArmoryXmlUtility.GetChildElementDecimal(element, "speed");
            damage.dps      = ArmoryXmlUtility.GetChildElementDecimal(element, "dps");
           
            return damage;
        }

        private ArmoryItemDamage()
        {}
    }
}
